<template>
  <div class="login pub_navbar">
    <van-nav-bar
      title="登录"
      left-arrow
      @click-left="leftArrowClick"
    ></van-nav-bar>
    <router-view></router-view>
    <div class="register_link" v-show="$route.name === 'signin'">
      <a href="#" @click="toRegister">没有账号,立即注册</a>
    </div>
  </div>
</template>

<script>
export default {
  name: 'loginIndex',
  data() {
    return {}
  },
  methods: {
    leftArrowClick() {
      const back = this.$route.query.back
      if (back) {
        this.$router.push(back)
      } else {
        this.$router.back()
      }
    },
    toRegister() {
      this.$router.push('signup')
    }
  }
}
</script>

<style lang="less" scoped>
.login {
  ::v-deep .van-nav-bar .van-icon {
    color: #fff;
  }

  .register_link {
    text-align: right;
    padding-right: 50px;
    & a {
      font-size: 12px;
    }
  }
}
</style>
